<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //剩余参数语法允许我们将一个不定数量的参数表示为一个数组
        var args = [];
        function sum(...args){
            let totle = 0;
            args.forEach(item =>totle +=item);
            // console.log(first);
            // console.log(args);
            return totle;
        }
        console.log(sum(20,60));
        sum(10,20,30);
    </script>
</body>
</html>